Component({
  properties: {
    selected:{
      type:Number,
      value:0,
    }
  },
  data: {
    // selected: 0, // 当前选中索引
    list: [
      {
        "pagePath": "/pages/home/home",
        "text": "首页",
        "iconPath": "/images/index.png",
        "selectedIconPath": "/images/indexx.png"
      },
      {
        "pagePath": "/pages/cun/cun",
        "text": "",
        "iconPath": "/images/cun.png",
        "selectedIconPath": "/images/cun.png"
      },
      {
        "pagePath": "/pages/mys/mys",
        "text": "个人中心",
        "iconPath": "/images/mys.png",
        "selectedIconPath": "/images/mys2.png"
      }
    ]
  },
  methods: {
    switchTab(e) {
      const path = e.currentTarget.dataset.path; 
      console.log('要跳转的路径：', path);
      // 用 wx.navigateTo 跳转（根据需求选，也可用 wx.redirectTo）
      wx.reLaunch({
        url: path,
        success() {
          console.log('跳转成功');
        },
        fail(err) {
          console.log('跳转失败原因：', err); 
        }
      });
      this.setData({selected: e.currentTarget.dataset.index}); 
    }
  }
})
